<template>
  <div>
    <!-- 派单 2018/3/7 11:44 zhangQ -->
    <Row>
      <i-col span="20" offset="4">
        <Form :model="assignForm" :label-width="150" ref="assignForm">
          <FormItem label="实际对位时间" prop="paraPositionTime">
            <DatePicker type="datetime" placeholder="实际对位时间" v-model="assignForm.paraPositionTime"></DatePicker>
          </FormItem>
        </Form>
      </i-col>
    </Row>
    <div class="xlinkModal-footer">
      <Button type="primary" @click="submitSendOrder">确认派单</Button>
    </div>
  </div>
</template>

<script>
  import { assignmentOrder } from '@api/backEnd/station'
  import moment from 'moment'

  export default {
    name: 'assignment-order',
    data () {
      let assignForm = {
        mainOrderNo: '',
        paraPositionTime: ''
      }
      let datas = { assignForm }
      return datas
    },
    props: {
      currentMainOrder: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    computed: {},
    methods: {
      submitSendOrder () {
        let mainOrderNo = this.currentMainOrder.orderNo
        let paraPositionTime = moment(this.assignForm.paraPositionTime).format('YYYY-MM-DD H:mm:ss')
        let param = { mainOrderNo, paraPositionTime }
        assignmentOrder(param).then(res => {
          if (res.data.isSuccess === 1) {
            this.$Message.info('派单成功')
            this.$emit('close', 'sendAssignmentOrderClose')
          } else {
            this.$Message.error(res.data.res)
          }
        })
      }
    },
    created () {
    },
    mounted () {
    },
    components: {}
  }
</script>

<style scoped>

</style>
